package com.it.tools;

import cn.hutool.core.date.DateUtil;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.Calendar;
import java.util.Date;

/**
 * @author 羡羡
 */
public class ComputerLocation {

    /**
     * 计算月
     * @param birth
     * @return
     */
    public static int computer(Date birth){
        Calendar stat=Calendar.getInstance();
        Calendar end=Calendar.getInstance();
        stat.setTime(birth);
        end.setTime(new Date());
        int stayear=stat.get(Calendar.YEAR);
        int endyear=end.get(Calendar.YEAR);

        int stamoth=stat.get(Calendar.MONTH);
        int endmoth=end.get(Calendar.MONTH);
        int monumber=(endyear-stayear) *12 +(endmoth-stamoth);
        int mnmber=monumber+1;
        return mnmber;
    }
}
